<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>IfExist / IfNotExist</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../css/default.css" rel="stylesheet" type="text/css">
</head>
<body>

<h1>IfExist / IfNotExist</h1>

<p>检查文件或文件夹是否存在.</p>

<pre class="Syntax">IfExist, FilePattern
IfNotExist, FilePattern
<a href="FileGetAttrib.htm#attrib">AttributeString</a> := <a href="../Functions.htm#FileExist">FileExist</a>(FilePattern)</pre>
<h3>参数</h3>
<table class="info">
  <tr> 
    <td width="15%">FilePattern</td>
    <td width="85%">需检查的路径, 文件名或文件模式. 如果未指定绝对路径则假定 <em>FilePattern</em> 在 <a href="../Variables.htm#WorkingDir">%A_WorkingDir%</a> 中.</td>
  </tr>
</table>

<h3>相关</h3>
<p><a href="../Functions.htm#FileExist">FileExist()</a>, <a href="Block.htm">区块</a>, <a href="Else.htm">Else</a>, <a href="Loop.htm">文件循环</a></p>
<h3>示例</h3>
<pre class="NoIndent">IfExist, D:\
    MsgBox, The drive exists.
IfExist, D:\Docs\*.txt
    MsgBox, At least one .txt file exists.
IfNotExist, C:\Temp\FlagFile.txt
    MsgBox, The target file does not exist.</pre>

</body>
</html>
